package cn.momoshenchi;

import com.aliyun.oss.OSSClient;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;

import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.InputStream;

/**
 * @version : 1.0
 * @author: momoshenchi
 * @date: 2021/4/28 - 10:27
 */
@SpringBootTest
public class T1
{
    @Autowired
    private OSSClient ossClient;

    @Test
    public void tets() throws FileNotFoundException
    {
        InputStream inputStream = new FileInputStream("D:\\desktop\\img\\image-20210314145432495.png");
// 。Object完整路径中不能包含Bucket名称。
        ossClient.putObject("gulimail-momoshenchi", "bu.txt", inputStream);
        ossClient.shutdown();
        System.out.println("success");
    }

}
